
 <template>
     <div>
       <h1>正佳国际</h1>
<Upload
        ref="upload"
        action="http://localhost:8092/file/upload/"
        :on-format-error="handleFormatError"
        :on-success="handleSuccess"
        :on-error="handleError"
        enctype="multipart/form-data"
        :format ="['xlsx','xls']">
        <Button type="primary" icon="ios-cloud-upload-outline">批量导入</Button>
</Upload>

     </div>


 </template>

 <script>
 export default {
     data(){
     	return{
     		uploadLoading: false,
     		file: null,
     	}
     },
     methods: {
                   handleFormatError(file){
                     this.$Notice.warning({
                       title: '文件格式不正确',
                       desc: '文件 ' + file.name + ' 格式不正确，请上传.xls,.xlsx文件。'
                     })
                   },
                   handleSuccess(res,file){
                       this.$Message.success("数据导入成功！")
                       //提示完渲染页面
                       this.getTreeData(1)
                   },
                   handleError(error,file){
                     this.$Message.error("数据导入失败！")
                   },
              
     }

}
 </script>

 <style>
 </style>
